#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QUdpSocket>
#include <QSettings>
#include <QLineEdit>
#include <QTextEdit>
#include <QPushButton>
#include <QApplication>

class MainWindow : public QMainWindow {
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void readPendingDatagrams();
    void sendDatagram();
    void cutText();
    void pasteText();

private:
    QUdpSocket *udpSocket;
    QLineEdit *localIpLabel;
    QTextEdit *receiveTextEdit;
    QTextEdit *sendTextEdit;
    QLineEdit *ipLineEdit;
    QLineEdit *portLineEdit;
    QPushButton *cutButton;
    QPushButton *pasteButton;
    QPushButton *sendButton;
    QSettings *settings;

    QString getLocalIpAddress();
    void loadSettings();
    void saveSettings();
};

#endif // MAINWINDOW_H
